<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>系统</title>
	<link rel="stylesheet" type="text/css" href="./css/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="./css/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="./css/themes/color.css">
	<link rel="stylesheet" href="./css/iconfont.css">
	<link rel="shortcut icon" href="./iconfont/favicon.ico" />
	<script type="text/javascript" src="./js/jquery.min.js"></script>
	<script type="text/javascript" src="./js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="./js/cookie.js"></script>
	<style>
	*{margin: 0;padding: 0}
	li{list-style: none}
	a{text-decoration: none;color:black}
	.panel-body {
            overflow-y: hidden;
        }
	</style>
</head>
<body>

	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north'" style="height:50px">
			<div class="easyui-panel" style="padding:5px;">
				<span id="nameuser"></span>
				<a href="#" id="exitlogin" class="easyui-linkbutton" data-options="plain:true">退出登录</a>
				<a href="#" class="easyui-menubutton" data-options="menu:'#mm3'">制作人</a>
			</div>
			<div id="mm3" class="menu-content" style="background:#f0f0f0;padding:10px;text-align:left">
				<img src="./images/wechat.jpg" style="width:150px;height:197px">
				<p style="font-size:14px;color:#444;">活成段子手的程序员</p>
			</div>
		</div>
		<div data-options="region:'south',split:true" style="height:50px;line-height: 50px">
			<center>仅供展示使用，如有问题请联系qq576152285</center>
		</div>
		<div data-options="region:'west',split:true" title="列表" style="width:200px;">
            <ul id="menus">
                <li><a link="./views/user.html" href="javascript:void(0)"  class="easyui-linkbutton c8" data-options="fit:true"><span class="iconfont icon-yonghu-tianchong"></span>　用户管理</a></li>
                <li><a link="./views/cate.html" href="javascript:void(0)"  class="easyui-linkbutton c8" data-options="fit:true"><span class="iconfont icon-fenzu"></span>　分类管理</a></li>
                <li><a link="./views/news.html" href="javascript:void(0)"  class="easyui-linkbutton c8" data-options="fit:true"><span class="iconfont icon-xinwen"></span>　新闻管理</a></li>
                <li><a link="./views/product.html" href="javascript:void(0)"  class="easyui-linkbutton c8" data-options="fit:true"><span class="iconfont icon-chanpin"></span>　产品管理</a></li>
                <li><a link="./views/comment.html" href="javascript:void(0)"  class="easyui-linkbutton c8" data-options="fit:true"><span class="iconfont icon-dingdan"></span>　评论管理</a></li>
            </ul>
		</div>
		<div data-options="region:'center',title:'主界面',iconCls:'icon-ok'">
            <div id="tt" class="easyui-tabs" data-options="fit:true">
		</div>
	</div>

</body>
</html>

<script>

$(function(){
	if(getcookie('username')){
		console.log(getcookie('username')+',欢迎登陆');
		$('#nameuser').html(getcookie('username')+',欢迎登陆');
	}else{
		location.href = './login.html';
	}
});

$('#exitlogin').click(function(){
    $.messager.confirm('确认对话框', '你确认退出登录吗?', function(r){
        if (r){
			delcookie('username');
			location.href = './index.html';
        }
    });
});
$("#menus li a").click(function(){
    var link =  $(this).attr('link');
    var title = $(this).text();
    addPanel(title,link);
});

function addPanel(title,link){
	if ($('#tt').tabs('exists', title)){
		$('#tt').tabs('select', title);
	} else {
			$('#tt').tabs('add',{
			title: title,
			content: `<iframe src="${link}" frameborder="0" style="width:100%;height:100%"></iframe>`,
			closable: true
		});
	}
}

$(document).ready(function(){
	addPanel('首页','./views/main.html');
})


var globalURL = 'http://182.254.177.121:3000/';

</script>